package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.YaoqingBean;
import com.lwj.liwanjia.impl.YaoQingView;
import com.lwj.liwanjia.model.YaoqingModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/11/1.
 */

public class YaoqingPresenter {
    private YaoqingModel yaoqingModel;
    private YaoQingView yaoQingView;

    public YaoqingPresenter(YaoQingView yaoQingView) {
        this.yaoQingView = yaoQingView;
        yaoqingModel = new YaoqingModel();
    }

    public void getYaoqingData(String token) {
        if (yaoQingView != null) {
            yaoqingModel.getYaoqingData(token, new Subscriber<YaoqingBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    yaoQingView.showError((Exception) e);
                }

                @Override
                public void onNext(YaoqingBean yaoqingBean) {
                    yaoQingView.getYaoqingData(yaoqingBean);
                }
            });
        }
    }
}
